package ddz;
import java.util.*;
public class lt3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int x = sc.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        System.out.println(heapSort(nums, k, x));
    }
    public static int heapSort(int[] nums, int k, int x){
        //从第一个不是叶子节点的节点开始初始化大根堆
        int n = nums.length;
        for (int i = n / 2 - 1; i >= 0 ; i--) {
            adjust_heap(nums, n, i);
        }

        //每次选取堆顶（最大）与最后一个交换，并调整堆，堆顶开始调整
        for (int i = 0; i < k; i++) {
            nums[0] -= x;
            adjust_heap(nums, n, 0);
        }
        return nums[0];
    }
    //调整堆
    public static void adjust_heap(int[] nums, int len, int parent){
        int leftChild = parent * 2 + 1;
        int rightChild = leftChild + 1;
        //左右孩子里面选最大的
        if(leftChild < len){
            int max_value = leftChild;
            if(rightChild < len){
                if(nums[rightChild] > nums[max_value])
                    max_value = rightChild;
            }
            //如果左右孩子大于parent，则需要交换，并且调整左堆或者右堆
            if(nums[parent] < nums[max_value]){
                int temp = nums[parent];
                nums[parent] = nums[max_value];
                nums[max_value] = temp;
                adjust_heap(nums, len, max_value);
            }
        }
    }
}
/*
5 3 5
4 3 11 2 1
 */